//
//  ItemVC4TableViewCell.m
//  喜马拉雅FM
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 lanou.com. All rights reserved.
//

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

#import "ItemVC4TableViewCell.h"
#import "ModelForDownLoad.h"
#import "UIImageView+WebCache.h"
#import "ModelForListen.h"

@interface ItemVC4TableViewCell ()

@property (nonatomic, retain) UIImageView *pictureImageView;
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UILabel *introLabel;

@end

@implementation ItemVC4TableViewCell

- (void)dealloc {

    [_pictureImageView release];
    [_titleLabel release];
    [_introLabel release];
    [super dealloc];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews {

    self.pictureImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"1.jpg"]];
    self.pictureImageView.frame = CGRectMake(10, 10, 80, 80);
    [self.contentView addSubview:self.pictureImageView];
    [self.pictureImageView release];
    
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 10, WIDTH - 100 - 50, 30)];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    [self.titleLabel release];
    
    self.introLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 50, WIDTH - 100 - 50, 30)];
    [self.contentView addSubview:self.introLabel];
    self.introLabel.textColor = [UIColor grayColor];
    [self.introLabel release];
    
//    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
//    button.frame = CGRectMake(WIDTH - 50, 34, 32, 32);
//    [self.contentView addSubview:button];
//    [button setImage:[UIImage imageNamed:@"xiazai"] forState:UIControlStateNormal];
//    [button setTintColor:[UIColor grayColor]];

}


- (void)passModelForDownLoad:(ModelForListen *)model {

    [self.pictureImageView sd_setImageWithURL:[NSURL URLWithString:model.coverSmall] placeholderImage:[UIImage imageNamed:@"2.jpg"]];
    self.titleLabel.text = model.title;
    self.introLabel.text = model.lastUptrackTitle;



}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
